package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.archive;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 文件中心，档案客户信息表
 */
@Data
@Entity
@Table(name = "t_archive_client")
@org.hibernate.annotations.Table(appliesTo = "t_archive_client", comment = "档案客户信息表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ArchiveClient implements Serializable {
    private static final long serialVersionUID = -7451169930807410104L;

    @Id
    @ApiModelProperty(value = "客户编号")
    @Column(name = "client_id", columnDefinition = "varchar(60) COMMENT '客户编号'")
    private String clientId;

    @ApiModelProperty(value = "客户类别")
    @Column(name = "client_type", columnDefinition = "varchar(10) COMMENT '客户类别 字典archive_client_type：10-股衍产品-12股衍机构'")
    private String clientType;

    @ApiModelProperty(value = "客户名称")
    @Column(name = "client_name", columnDefinition = "varchar(255) COMMENT '客户名称'")
    private String clientName;


    private String provinceId;
    private String cityId;
    private String areaId;


    @ApiModelProperty(value = "详细地址")
    @Column(name = "address ", columnDefinition = "varchar(255) COMMENT '详细地址'")
    private String address;

    @ApiModelProperty(value = "营业执照编码")
    @Column(name = "business_license_code", columnDefinition = "varchar(100) COMMENT '营业执照编码'")
    private String businessLicenseCode;

    @ApiModelProperty(value = "联系人姓名")
    @Column(name = "contact_person_name", columnDefinition = "varchar(255) COMMENT '营业执照编码'")
    private String contactPersonName;

    @ApiModelProperty(value = "联系人电话")
    @Column(name = "telephone", columnDefinition = "varchar(20) COMMENT '联系人电话'")
    private String telephone;

    @ApiModelProperty(value = "联系人手机")
    @Column(name = "mobile ", columnDefinition = "varchar(20) COMMENT '联系人手机'")
    private String mobile;

    @Transient
    @ApiModelProperty(value = "待处理的文件数量")
    private Integer waitDealFileCount;

    @ApiModelProperty(value = "创建人ID")
    @Column(name = "create_operator", columnDefinition = "varchar(20) COMMENT '创建人ID'")
    protected String createOperator;

    @ApiModelProperty(value = "创建人姓名")
    @Column(name = "create_operator_name", columnDefinition = "varchar(20) COMMENT '创建人姓名'")
    protected String createOperatorName;

    @ApiModelProperty(value = "操作人员ID")
    @Column(name = "op_operator", columnDefinition = "varchar(20) COMMENT '操作人员ID'")
    protected String opOperator;

    @ApiModelProperty(value = "操作人员姓名")
    @Column(name = "op_operator_name", columnDefinition = "varchar(20) COMMENT '操作人员姓名'")
    protected String opOperatorName;

    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @Column(name = "op_time", columnDefinition = "datetime comment '更新时间'")
    @ApiModelProperty(value = "操作时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime opTime;

//    @ApiModelProperty(value = "交易对手方名称")
//    @Transient
//    private String partyName;
//
//    @ApiModelProperty(value = "交易对手方组织机构代码")
//    @Transient
//    private String partyOrganCode;

    @ApiModelProperty(value = "交易对手方信息")
    @Transient
    private CounterParty counterParty;

    @Column(name = "party_id", columnDefinition = "int(20) comment '交易对手方id'")
    private Integer partyId;


}
